1 using UnityEngine;
2 using
System.Collections;
3
4 namespace
MainMenu
5 {
6     
public class MainMenuAnimals : MonoBehaviour
7     {
8
9         
public GameObject[] animals;
10
11         
public void Start()
12         {
13             
for (int i = 0; i < 3; i++)
14                 animals[i].GetComponent<Actor>().addAction(
new ActionSequence(new ActionDelay(1.6f), new ActionScaleTo(1, 1, 0.2f, Interpolation.sine)));
15
16             gameObject.AddComponent<Actor>().addAction(
new ActionSequence(new ActionDelay(1.4f), new ActionRunnable(
17                 
delegate() {
18                     SoundManager.LoadBgMusic(
"Sounds/menu", false);
19                     SoundManager.playSound(
"Sounds/roga");
20                 }
21                 )));
22
23             
float[] aY = new float[] { 0.01f, 0.01f, -0.02f };
24             
float[] ds = new float[] { 0.2f, 0.4f, 0.3f };
25             
for (int i = 0; i < 3; i++)
26             {
27                 animals[i].GetComponent<Actor>().addAction(
new ActionRepeat(ActionRepeat.FOREVER, new ActionSequence(
28                     
new ActionMoveTo(animals[i].transform.localPosition.x, aY[i] + 0.1f, 1 + ds[i], Interpolation.sine),
29                     
new ActionMoveTo(animals[i].transform.localPosition.x, aY[i], 1 + ds[i], Interpolation.sine)
30                 )));
31             }
32         }
33     }
34 }



Trò chơi đua xe động vật trong UNITY Engine 114.672 lượt xem

Gõ tìm kiếm nhanh...